Repository navigation
Add image/apng media type - #1559
Merged
olivervogel merged 1 commit intoNov 23, 2026
Merged
Conversation
Member
|
Thanks for finding that @nlemoine . That's an important fix that probably wouldn't have been noticed. Could you please remove the test image? You can leave the (failing) tests. I'll add my own. |
PHP 8.6 bundles libmagic 5.48, which reports animated PNG files as image/apng. The GD decoders read the media type through finfo, could not map this value and threw, so every decoder in the chain failed and the user got "Unsupported image source type". Map image/apng to the PNG format, like the other alias media types.
nlemoine
force-pushed
the
bugfix/apng-media-type
branch
from
November 23, 2026 15:02
a1544b4 to
8cf1218
Compare
Contributor
Author
|
@olivervogel The image has been removed, you can add your own. |
Member
|
Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On PHP 8.6 the GD driver fails to decode an animated PNG:
PHP 8.6 bundles libmagic 5.48, and
finfonow reportsimage/apngfor a PNG with anacTLchunk, where PHP 8.5 saidimage/png. The GD decoders get the media type fromfinfo,image/apngis not a case ofMediaType, so they throwUnsupported media type (MIME) image/apng. The caller does not see that message, only the generic one above.image/apngis now an alias media type of the PNG format, likeimage/x-pngorimage/x-bmp3(#1427). It comes afterIMAGE_PNG, soFormat::PNG->mediaType()and the encoders still giveimage/png. GD keeps reading only the first frame, same as before.The decoder tests use a new 229 bytes APNG fixture. They only fail without the change on PHP 8.6, on older versions
finfostill saysimage/png.Imagick is not affected, it does not use
finfo.